package cn.lystudio.rohmtimeopwide_background_v11.controller.appApi;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.util.SaResult;
import cn.hutool.core.collection.CollUtil;
import cn.lystudio.rohmtimeopwide_background_v11.entity.vo.RecordTimeLineVO;
import cn.lystudio.rohmtimeopwide_background_v11.service.RecordTimeLineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/app-api/recordtimeline")
@CrossOrigin
@SaIgnore
@Slf4j
public class AppRecordTimeLineController {
    private RecordTimeLineService recordTimeLineService;

    @Autowired
    public void setRecordTimeLineService(RecordTimeLineService recordTimeLineService) {
        this.recordTimeLineService = recordTimeLineService;
    }

    @GetMapping("/getRecordTimeLine")
    public SaResult getRecordTimeLine(String machineNo,String beginDate,String endDate){
        List<RecordTimeLineVO> recordTimeLineList=recordTimeLineService.getRecordTimeLine(machineNo, beginDate, endDate);
        if(CollUtil.isEmpty(recordTimeLineList)) return SaResult.error("无数据");

        return SaResult.data(recordTimeLineList);
    }


}
